<?php
class CategoryModel extends RelationModel{
	public $_link = array(
		
		'Category'=> array(
				'mapping_type'=>HAS_MANY, 
				'class_name'=>'Category', 
				'parent_key'=>'parent', 
				'foreign_key'=>'parent',
				'mapping_name'=>'subCategories', 
				'mapping_order'=>'order_key desc', 
		),

		'ProductCategoryMapping'=>array(
				'mapping_type'  =>MANY_TO_MANY, 
			    'class_name'  =>'ProductCategoryMapping',
				'foreign_key'=>'category_id',
				'relation_foreign_key'=>'t_product_id',
		    	'mapping_name' => 'Products',
				'relation_table' => 't_product_category_mapping'),

	);
}